<p><?= $this->App->buttonLink('+ Nova Ponuda', '/offers/create') ?></p>
<?= $this->element('entity_table', array(
    'columns' => array(
        'Id'       => 'Offer.id',
        'Lokacije' => array('Location.name', function($row) {
            $items = array();
            foreach($row['Location'] as $location) {
                $items[] = '<p>' . 
                    $location['name'] . ' (' .
                    date_local($location['OffersLocation']['start']) . ' - ' .
                    date_local($location['OffersLocation']['end']) . ')' .
                '</p>';
            }
            
            return implode('', $items);
        }),
        'Klijent'  => 'Client.name',
        'Kampanja' => 'Campaign.label'
    ),
    'columnWidth' => array(
        'Id'            => '1%',
        'Lokacija'      => '40%',
        'Klijent'       => '25%',
        'Kampanja'      => '20%'
    ),
    'links' => array(
        'Id'       => array('/offers/edit/%d', 'Offer.id'),
        'Lokacija' => array('/locations/edit/%d', 'Location.id'),
        'Klijent'  => array('/clients/edit/%d', 'Client.id'),
        'Kampanja' => array('/campaigns/edit/%d', 'Campaign.id')
    ),
    'filter' => array(
        'Od'       => ''.@$filter['Offer']['start'],
        'Do'       => ''.@$filter['Offer']['end'],
        'Lokacija' => ''.@$filter['Location']['name'],
        'Klijent'  => ''.@$filter['Client']['name']
    ),
    'actions'  => array(
        array(
            'label'   => 'Štampaj', 
            'link'    => 'javascript:pdfPonuda(\'%s\')'
        )
    ),
    'data'     => $offers,
    'id'       => 'Offer.id',
    'entity'   => 'offers',
    'sort_by'  => $sort_by,
    'sort_dir' => $sort_dir
)) ?>